<html>
<head>
    <title>Centrifugo quick start</title>
</head>
<body>
<div id="counter">-</div>
<script src="https://cdn.jsdelivr.net/gh/centrifugal/centrifuge-js@2.8.0/dist/centrifuge.min.js"></script>
<script type="text/javascript">
    const container = document.getElementById('counter')
    const centrifuge = new Centrifuge("ws://1.14.94.209:8000/connection/websocket");
    centrifuge.setToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxOSIsImV4cCI6MH0.J_LrN5Uc4d7sHDLuligOATWsEdqKffX2mr1walHkvC4");

    centrifuge.on('connect', function(ctx) {
        console.log("connected", ctx);
    });

    centrifuge.on('disconnect', function(ctx) {
        console.log("disconnected", ctx);
    });

    centrifuge.subscribe("C2C_19", function(ctx) {
        container.innerHTML = JSON.stringify(ctx.data);
        document.title = JSON.stringify(ctx.data);
    });

    centrifuge.connect();
</script>
</body>
</html>